package main

import (
	"fmt"
	"encoding/json"
)


type Student struct {
	Name string `json:"name"`   //反射机制
	Age int `json:"age"`
	Sal float64 `json:"sal"`
}

func testStruct() {
	var student Student
	s := "{\"Name\":\"json串\",\"Age\":15,\"Sal\":78.09}"

	err := json.Unmarshal([]byte(s),&student)

	if err != nil {
		fmt.Println("序列化错误，错误：",err)
		return
	}
	fmt.Println("反序列化结果：",student)
}

func main()  {
	testStruct()
}
